Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactoring: imagery library resolve cppcheck warnings #3356

Merged
merged 3 commits into from
Jan 14, 2024

Conversation

Sharansrj567
Copy link
Contributor

This PR addresses warnings identified by Cppcheck in the lib/imagery/group.c file:

[duplicateExpression]: Refactored redundant conditions in the color assignment logic for improved code clarity.

[invalidscanf]: Added limits to fscanf to prevent potential crashes with large string inputs.

[variableScope]: Reduced variable scope to address scope warnings.

These modifications aim to enhance code clarity, ensure safer input processing, and resolve scope-related warnings in the imagery library.

Changes Made:

Refactored redundant conditions in color assignment logic.
Added limits to fscanf for safer input processing.
Reduced variable scope to address scope warnings.

Testing:

Manual testing performed to ensure the behavior of group.c functions remains unchanged.
Style check conducted using clang-format to maintain standard formatting.

@github-actions github-actions bot added C Related code is in C libraries docs imagery labels Jan 12, 2024
@echoix
Copy link
Member

echoix commented Jan 13, 2024

While you used clang-format, we currently use a specific configuration file together with version 15 of clang-format. Version changes of clang-format have varying output, so we stick to one for a while to limit churn.

This explains the clang-format CI failure you can see.

lib/imagery/group.c Outdated Show resolved Hide resolved
@marisn marisn merged commit 206b69e into OSGeo:main Jan 14, 2024
23 checks passed
@neteler neteler added this to the 8.4.0 milestone Jan 14, 2024
@neteler neteler changed the title refactor: imagery library resolve cppcheck warnings refactoring: imagery library resolve cppcheck warnings Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C imagery libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants